package com.yxinsur.imc.business.enums;

import com.yxinsur.imc.common.utils.StringUtils;
import lombok.Getter;

/**
 * 计算方式  滚动  自然
 */
@Getter
public enum PersistencyMethodEnum {

    ROLL("滚动"),
    ANROLL("自然");


    private String code;

    private PersistencyMethodEnum(String code) {
        this.code = code;
    }

    public static String getCodeByMethod(String method) {
        String keyValue = null;
        if (StringUtils.isNotBlank(method)) {
            for (PersistencyMethodEnum c : PersistencyMethodEnum.values()) {
                if (c.name().contains(method)) {
                    keyValue = c.getCode();
                    break;
                }
            }
        }
        return keyValue;
    }
}
